package com.da.javatest.leetCode;

import java.util.HashSet;
import java.util.Set;

/**
 * @author chenlida
 * @date 2019/1/5 11:43
 * @description
 */
public class Code575 {
    public int distributeCandies(int[] candies) {
        Set<Integer> r = new HashSet<>(candies.length);
        for (int candy : candies) {
            r.add(candy);
        }
        return r.size() > candies.length / 2 ? candies.length / 2 : r.size();
    }
}
